<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
<script src="/js/jquery.ajaxupload.js"></script>
<link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/blitzer/jquery-ui.min.css"/>
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<script type="text/javascript" src="https://getfirebug.com/firebug-lite.js"></script>
<![endif]-->
<script type="text/javascript">
	jQuery(function ($) {
        // Set fieldname
        $.ajaxUploadSettings.name = 'uploads[]';
        // Set promptzone
        $('#outside a').ajaxUploadPrompt({
        	method : 'POST',
        	data: {"photo": 'outside'},
		    processData: false,
		    contentType: 'application/json',
	        url : '/contact/upload',
	        beforeSend : function () {
	        },
	        onprogress : function (e) {
	        },
	        error : function () {
	        },
	        success : function (data) {
		        data = $.parseJSON(data);
		        $('#outside').find('input#file_outside').val(data['filename']);
		        $('#outside').find('img').attr('src', data['file']);
	        }
        });
      });
 </script>
<h1>Add new Representative</h1>
<?php if (!isset($success)){?>
<form class="form-horizontal" action="" method="POST">
<div class="col-lg-12">
<div class="row">
    <div class="col-lg-6">
    	<div class="control-group">
    		<label class="control-label" for="inputRole">Role</label>
    		<div class="controls">
    			<select class="form-control" name="data[role]" id="inputRole">
    				<option value="representative">Representative</option>
    				<option value="admin">Administrator</option>
    			</select>
    		</div>
    	</div>
    	<div class="control-group">
    		<label class="control-label" for="inputUsername">Login</label>
    		<div class="controls">
    			<input class="form-control" name="data[username]" type="text" id="inputUsername" placeholder="Username" required>
    		</div>
    	</div>
    	<div class="control-group">
    		<label class="control-label" for="inputPassword">Password</label>
    		<div class="controls">
    			<input class="form-control" name="data[password]" type="text" id="inputPassword" placeholder="Password">
    		</div>
    	</div>
    	<div class="control-group">
    		<label class="control-label" for="inputFname">First Name</label>
    		<div class="controls">
    			<input class="form-control" name="data[fname]" type="text" id="inputFname" placeholder="First Name">
    		</div>
    	</div>
    	<div class="control-group">
    		<label class="control-label" for="inputLname">Last Name</label>
    		<div class="controls">
    			<input class="form-control" name="data[lname]" type="text" id="inputLname" placeholder="Last Name">
    		</div>
    	</div>
        <div class="control-group">
    		<label class="control-label" for="inputEmail">Phone</label>
    		<div class="controls">
    			<input class="form-control" name="data[phone]" type="text" id="inputEmail" placeholder="Mobile number" required>
    		</div>
    	</div>
    	<div class="control-group">
    		<label class="control-label" for="inputEmail">Email</label>
    		<div class="controls">
    			<input class="form-control" name="data[email]" type="text" id="inputEmail" placeholder="@vitadiet.com.au" required>
    		</div>
    	</div>
        <br />
    	<div class="control-group">
    		<div class="controls">
    			<button type="submit" class="btn btn-primary">Add User</button>
    		</div>
    	</div>
     </div>
     
     <div class="col-lg-6" id="outside">
         <input type="hidden" name="photos[outside]" value="" id="file_outside">
        <div align="center"><strong>Avarta</strong></div>
        <a class="thumbnail" href="#">
           <img class="img-rounded" src="/images/upload-photo.png"/>
        </a>
     </div>
    </div>
</div>
</form>
<?php }else{ ?>
New user was successfully created!
	<a href="/users/list">Back to users list</a> or <a href="/users/add">Create new user</a>
<?php }?>